import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'amfe-flexible'; //引入flexible.js，->设置跟根标签字体大小(移动端适配)

// 按需加载vant组件
import {
  NavBar,
  Form,
  Field,
  Button,
  Tabbar,
  TabbarItem,
  Icon,
  Tab,
  Tabs,
  Cell,
  List,
  PullRefresh,
  ActionSheet,
  Popup,
  Row,
  Col,
  Badge,
  Search,
  Image as VanImage,
  Divider
} from "vant";

Vue.use(NavBar);
Vue.use(Form);
Vue.use(Field);
Vue.use(Button);
Vue.use(Button);
Vue.use(Tabbar);
Vue.use(TabbarItem);
Vue.use(Icon);
Vue.use(Tab);
Vue.use(Tabs);
Vue.use(Cell);
Vue.use(List);
Vue.use(PullRefresh);
Vue.use(ActionSheet);
Vue.use(Popup);
Vue.use(Row);
Vue.use(Col);
Vue.use(Badge);
Vue.use(Search);
Vue.use(VanImage);
Vue.use(Divider);

Vue.config.productionTip = false

const directiveObj = {
  install(Vue) {
    Vue.directive('fofo', { //全局自定义指令 input聚焦
      inserted(el) {
        // console.log(el, '全局自定义指令');
        let thenInput = el.querySelector('input')
        thenInput.focus()
        // console.log(thenInput, '全局自定义指令');
      }
    })
  }
}
// 执行目标对象里install方法并传入Vue类
Vue.use(directiveObj);


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')